/*
 * GameEvent.java
 *
 * Created on 14 de Julho de 2011, 18:12
 *
 */

package intopo.game.gui;

import intopo.game.Game;
import intopo.game.Strategy;

/**
 * This class is used to notify which parameter in a game was updated.
 *
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 14 de Julho de 2011
 */
final public class GameEvent<
		G extends Game<S>,
		S extends Strategy<S>>
	extends java.util.EventObject
{
	/**
	 * The game whose parameter was updated.
	 */
	final private G game;
	/**
	 * The name of the parameter that was updated.
	 */
	final private String parameterName;
	/**
	 * The old value of the parameter.
	 */
	final private Object oldValue;
	/**
	 * The new value of the parameter.
	 */
	final private Object newValue;
	/**
	 * Creates a new instance of {@code GameEvent}
	 * @param game The game whose parameter was updated.
	 * @param parameterName The name of the parameter that was updated.
	 * @param oldValue The old value of the parameter.
	 * @param newValue The new value of the parameter.
	 */
	public GameEvent (G game, String parameterName, Object oldValue, Object newValue)
	{
		super (game);
		this.game = game;
		this.parameterName = parameterName;
		this.oldValue = oldValue;
		this.newValue = newValue;
	}
	/**
	 * Get the game whose parameter was updated.
	 * @return the game whose parameter was updated.
	 */
	public G getGame ()
	{
		return this.game;
	}
	/**
	 * Get the name of the parameter that was updated.
	 * @return the name of the parameter that was updated.
	 */
	public String getParameterName ()
	{
		return this.parameterName;
	}
	/**
	 * Get the old value of the parameter.
	 * @return the old value of the parameter.
	 */
	public Object getOldValue ()
	{
		return this.oldValue;
	}
	/**
	 * Get the new value of the parameter.
	 * @return the new value of the parameter.
	 */
	public Object getNewValue ()
	{
		return this.newValue;
	}
}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
